package com.hbnu.test.www.Equals;

public class Equalss {
    private String name;
    private int age;
    public boolean equalss(Object obj){
        //判断是否为空
        if(null == obj){
            return false;
        }
        //判断地址是否相同
        if(this == obj){
            return true;
        }
        //判断是否为同类型
        if(this.getClass() != obj.getClass()){
            return false;
        }
        //创建对象
        Equalss eq = (Equalss)obj;
        return eq.getName().equals(getName()) && eq.getAge() == getAge();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

}
